package com.ziytek.web.citizen.model.rsp;

import com.ziytek.web.citizen.constant.NumConstant;
import com.ziytek.web.citizen.constant.ServerConstant;
import com.ziytek.web.citizen.enums.ResponseEnum;
import lombok.Data;

/**
 * @className SingleBatteryCellRsp
 * @description: 描述
 * @jdkVersion: 1.8
 * @author: fhx
 * @date: 2024/7/2 9:53
 */
@Data
public class SingleBatteryCellRsp {
    /**
     * 返回编码
     */
    private String retCode;

    /**
     * 编码描述
     */
    private String retMsg;

    /**
     * 电池电流值
     */
    private Integer current;

    /**
     * 电池电压值
     */
    private Integer voltage;

    /**
     * 电池容量
     */
    private Float capacity;


    public void setRetErrorData(String retMsg) {
        this.voltage = NumConstant.INT_ZERO;
        this.current = NumConstant.INT_ZERO;
        this.capacity = NumConstant.FLOAT_ZER;
        this.retMsg = retMsg;
        this.retCode = ServerConstant.ERROR;
    }

    public void setRetSuccessData(int current, int voltage, float capacity) {
        this.retMsg = ResponseEnum.SUCCESS.getDesc();
        this.retCode = ServerConstant.SUCCESS;
        this.current = current;
        this.voltage = voltage;
        this.capacity = capacity;
    }
}
